package com.example.makerspace.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.makerspace.domain.StagingProductDO;
import com.example.makerspace.mapper.StagingProductMapper;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@Component
public class StagingProductDAO extends  BaseDAO<StagingProductDO> {
    @Resource
    private StagingProductMapper stagingProductMapper;

    @PostConstruct
    public void init(){
        this.mapper = stagingProductMapper;
    }

    public List<StagingProductDO> selectByDemandName(String demandName) {
        QueryWrapper<StagingProductDO> wrapper = new QueryWrapper<>();
        wrapper.eq("demand_name",demandName);
        return mapper.selectList(wrapper);
    }

    public List<StagingProductDO> selectByUserName(String username) {
        QueryWrapper<StagingProductDO> wrapper = new QueryWrapper<>();
        wrapper.eq("username",username);
        return mapper.selectList(wrapper);
    }
}
